<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./layui/layui.js"></script>
    <link rel="stylesheet" href="./layui/css/layui.css">
</head>

<body>
    <button>去登录</button>
    <script>

        layui.use(function () {
            $ = layui.$;
            let layer = layui.layer
            $('button').click(function () {
                layer.open({
                    type: 2,
                    area: ['680px', '520px'],
                    content: './login.html',
                    fixed: false, // 不固定
                    maxmin: true,
                    shadeClose: true,
                    // btn: ['获取表单值', '取消'],
                    btnAlign: 'c',

                });
            })
        })


        // 父页面监听一个自定义的事件

        window.addEventListener('message', event => {
            console.log('收到了消息 ', event.data);
        });
    </script>

</body>

</html>